package com.gaofeng.day11;

import java.util.Arrays;

/**
 * @author gaofeng
 * @date 2024-12-22 - 12:21
 */
public class demo01 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        System.out.println(Arrays.stream(arr).sum());

        double[] arr2 = {1.2,2.3,3.4};
        System.out.println(arr2[1]);
        for (double v : arr2) {
            System.out.println(v);
        }

        int[] arr3 = {1,2,3,4,5};
        int sum = 0;

        for (int i : arr3) {
            sum += i;
        }
        System.out.println(sum);
        
        int[] arr4 = {1,2,3,4,5,6,7,8,9,10};

        for (int i = 0; i < arr4.length; i++) {
            if(arr4[i] % 2 == 0){
                arr4[i] /= 2;
            }else {
                arr4[i] *= 2;
            }
        }
        for (int i = 0; i < arr4.length; i++) {
            System.out.println(arr4[i]);
        }
     }
}
